#include "sys.h"
#include "net.h"
#include "miss.h"
#include "miss_interface.h"
#include "miss_error.h"
#include "capture.h"
#include "dial.h"
#include "onu_comm.h"

extern thread_pool_t *Tpool;
static int Count = 5;

int accept_process_data(PProcessResult pData, IN void* arg)
{
	if(Count-- == 0){
		log_trace("miss_test_stop");
		miss_test_stop();
	}
    log_trace("***************** int test.c: rate = %.2f Mbps, sendRate = %.2f, lost = %.2f\n", pData->dRate, pData->dSendRate, pData->dLost);
    return 0;
}

void* udp_test(void *arg)
{
	int ret = 0, count = 0;

	//while(1){
		log_trace("count:%d", count++);
		ret = miss_test_start("10.0.0.31", 18081, 18082, 100, 15, 1, 1000, 2, accept_process_data);
	    log_trace("ret:%d", ret);
	    miss_test_stop();
	    sleep(1);
	//}
    
}


int udp_task_init(int argc, char** argv)
{
    thread_pool_add_task(Tpool, udp_test, NULL);
    return 0;
}
